import pytest
import requests
from Api.ihrmEmpManageApi import EmpMangeApi
from common.dbTools import DBTools
from common.assretTools import common_tools
from common.getHeader import get_header
from common.readjsonTools import read_json_file
from config import base_path
class TestAddEmpParams(object):
    def setup_class(self):
        self.emp = EmpMangeApi()
        # 准备请求头
        self.req_header=get_header()
    def setup(self):
        DBTools.db_iud("delete from bs_user where mobile = '19933652415';")
    def teardown(self):
        DBTools.db_iud("delete from bs_user where mobile = '19933652415';")
    # 准备Json文件的绝对路径
    failname = base_path + "/data/addemp.json"
    # 调用函数得到json文件
    data = read_json_file(failname)
    @pytest.mark.parametrize("desc,data,status_code, success, code, message", data)
    def test_add_emp(self,desc,data,status_code, success, code, message):
        resp = self.emp.add_emp(self.req_header,data)
        print(desc,"：", resp.json())
        common_tools(resp, status_code, success, code, message)

